<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AlterTableCustomerCouponsAddSource extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('customer_coupons', function (Blueprint $table) {
            $table->unsignedTinyInteger('source')->default(1)->after("userId")->comment('来源 1 - 活动 2 - 券包');
            $table->string('sourceName', 200)->default("")->after("userId")->comment('来源 活动名称｜券包名称');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('customer_coupons', function (Blueprint $table) {
            $table->dropColumn(["source", "sourceName"]);
        });
    }
}
